///* 
// * To change this template, choose Tools | Templates
// * and open the template in the editor.
// */


function handleLoadStart(ext) {
    console.log("Entra en handleLoadStart");
    if(ext.direction == "down"){
        console.log("Entra en borrar waypointWidget");
        PF('waypointWidget').remove(); 
            //loadMoreCandidates();
            handleLoadStop(0,0,0);
        console.log("Sale de borrar waypointWidget");
   }

} 

function handleLoadStop(loaded,maxperrow,maxcan) {
            $list = $("#list");
            var params = { start: $list.find("img").length, component: "list" };
            console.log($list.find("img").length);
        $.get(location, params, function(html) {
            //console.log(html);
            //$(".dataListFacesList").append(html);
        });
    /*if(loaded+maxperrow<maxcan){
    console.log("Entra en que debe registrar el waypoint");
    $(".dataListFacesList").find('img').batchImageLoad({
        loadingCompleteCallback: function(){
            console.log("Registra");
            PF('waypointWidget').register();
            console.log("Sale de registrar");
        }
    });
    console.log("Sale");
    }*/
} 

function reinitWaypoint(){
    console.log(PF('waypointWidget'));
    PF('waypointWidget').remove();
    PF('waypointWidget').register();
}

function prueba(ext){
    console.log("entra");
    if(ext.direction == "down"){
        PF('waypointWidget').remove();
        $list = $("#list");
        var params = { start: $list.find("img").length, component: "listRepeater1" };
        $.get(location, params, function(html) {
            if($("#list").find("img").length < $(PrimeFaces.escapeClientId('totalFacesForm'+":facesTotalNumber")).val()){
                $list.append(html);
                PF('waypointWidget').register();
                console.log("registra"); 
            }
            
            //updateFooter();
            //console.log("updatedFooter");
        });
   }
    
}